﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using Lamex.Library;

namespace Lamex.mLabor.UI
{
    //CardView 设置字段的样式
    //https://blog.csdn.net/u011176794/article/details/79866433

    public partial class frmLBR_Worker_Location : frmBaseChild
    {
        string strSql, CurUser;
        DataTable dt;

        public frmLBR_Worker_Location()
        {
            InitializeComponent();
        }

        private void frmLBR_Worker_Location_Load(object sender, EventArgs e)
        {
            strSql = @"SELECT WORKER_NO AS 工号,WORKER_NAME AS 姓名,PHOTO AS 照片 FROM HR_Workers_Info";
            dt = Lamex.Base.BaseBuildSql.GetDataTableBySql(strSql);
            gridControl1.DataSource = dt;

            strSql = @"SELECT DISTINCT WORKSTATION FROM View_OP_Resource_Plan";
            dt = Lamex.Base.BaseBuildSql.GetDataTableBySql(strSql);
            gridControl2.DataSource = dt;
        }

        ////更改gridcontrol控件cardview的cardCaption标题
        //private void cardView1_CustomDrawCardCaption(object sender, DevExpress.XtraGrid.Views.Card.CardCaptionCustomDrawEventArgs e)
        //{
        //    CardView view = sender as DevExpress.XtraGrid.Views.Card.CardView;
        //    (e.CardInfo as CardInfo).CaptionInfo.CardCaption = view.GetRowCellDisplayText(e.RowHandle, view.Columns[0]);
        //}

        //private void cardView2_CustomDrawCardCaption(object sender, DevExpress.XtraGrid.Views.Card.CardCaptionCustomDrawEventArgs e)
        //{
        //    CardView view = sender as DevExpress.XtraGrid.Views.Card.CardView;
        //    (e.CardInfo as CardInfo).CaptionInfo.CardCaption = view.GetRowCellDisplayText(e.RowHandle, view.Columns[0]);
        //}

        private void 显示站点ToolStripMenuItem1_Click(object sender, EventArgs e)
        {

        }

        private void 显示工序ToolStripMenuItem1_Click(object sender, EventArgs e)
        {

        }

        private void 显示站点ToolStripMenuItem2_Click(object sender, EventArgs e)
        {
            layoutView2.Columns.Clear();
            strSql = @"SELECT DISTINCT WORKSTATION FROM View_OP_Resource_Plan";
            dt = Lamex.Base.BaseBuildSql.GetDataTableBySql(strSql);
            gridControl2.DataSource = dt;
        }

        private void 显示工序ToolStripMenuItem2_Click(object sender, EventArgs e)
        {
            layoutView2.Columns.Clear();
            strSql = @"SELECT DISTINCT PROCESS_NAME FROM View_OP_Resource_Plan";
            dt = Lamex.Base.BaseBuildSql.GetDataTableBySql(strSql);
            gridControl2.DataSource = dt;
        }
    }
}